package com.zhengqiangblog.core;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class Model {

	private Map<String, String> pathVariables = new HashMap<String, String>();
	private Map<String, Object> resultParams = new HashMap<String, Object>();

	private HttpServletRequest request;

	public Model(HttpServletRequest request) {
		this.request = request;
	}

	public void addPathVariable(String name, String value) {
		pathVariables.put(name, value);
	}

	public String getPathVariable(String name) {
		return pathVariables.get(name);
	}

	public void addAttribute(String name, Object value) {
		request.setAttribute(name, value);
	}

	public void addResultParam(String name, Object value) {
		this.resultParams.put(name, value);
	}

	public Object getResultParam(String name) {
		return this.resultParams.get(name);
	}

	public HttpSession getSession() {
		return request.getSession();
	}

}
